  import { NestFactory } from '@nestjs/core';
  import { AppModule } from './app.module';
  import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';

  async function bootstrap() {
    const app = await NestFactory.create(AppModule);

    // 安装Swagger
    const options = new DocumentBuilder()
      .setTitle('nest-demo api')
      .setDescription('练习nest的demo')
      .setVersion('1.0')
      .build();

    const document = SwaggerModule.createDocument(app, options, {
      ignoreGlobalPrefix: true,
    });
    SwaggerModule.setup('api', app, document);

    await app.listen(3000);
  }
  bootstrap();
